<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->

    <!--<link rel="stylesheet" href="css/normalize.css">-->
    <link rel="stylesheet" href="${ctx}/bootstrap/css/main.css">
    <script src="${ctx}/bootstrap/js/vendor/modernizr-2.6.2.min.js"></script>

    <!--[if (lt IE 9) & (!IEMobile)]>
    <script src="${ctx}/bootstrap/js/vendor/respond.min.js"></script>
    <![endif]-->
</head>

<body>

<div class="container" style="padding-top: 20px">


    <div class="row panel panel-primary clearfix">
        <div class="panel-heading">
            <h3 class="panel-title">店铺信息</h3>
        </div>
        <div class="panel-body">
            <form role="form">
                <input type="hidden" id="sellerId" value="${seller.sellerId}"/>

                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="name">店铺名称</label>
                            <input type="text" class="form-control" id="name" value="${seller.name}">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="corporation">法人名称</label>
                            <input type="text" class="form-control" id="corporation" value="${seller.corporation}">
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="form-group">
                            <label for="bankAccount">银行账号</label>
                            <input type="text" class="form-control" id="bankAccount" value="${seller.bankAccount}">
                        </div>
                    </div>
                </div>
            </form>

            <div class="row">
                <div class="col-md-12">
                    <button class="btn btn-primary pull-left" onclick="updateForm();">提交</button>
                    <span class="glyphicon glyphicon-alert"></span>
                    <span class="icon fa fa-home"></span>
                </div>
            </div>
        </div>
    </div>
    <c:if test="${not empty busPics}">
        <div class="row panel panel-primary clearfix">
            <div class="panel-heading">
                <h3 class="panel-title">营业执照照片</h3>
            </div>
            <div class="col-md-12 column">
                <div id="homepage-feature" class="carousel">
                    <ol class="carousel-indicators">
                        <c:forEach var="pic" items="${busPics}" varStatus="status">
                            <c:if test="${status.index == 0}">
                                <li data-target="#homepage-feature" data-slide-to="${status.index}" class="active"></li>
                            </c:if>
                            <c:if test="${status.index != 0}">
                                <li data-target="#homepage-feature" data-slide-to="${status.index}"></li>
                            </c:if>
                        </c:forEach>
                    </ol>
                    <div class="carousel-inner">
                        <c:forEach var="pic" items="${busPics}"  varStatus="status">
                            <c:if test="${status.index == 0}">
                                <div class="item active">
                                    <img src="${pic}">
                                </div>
                            </c:if>
                            <c:if test="${status.index != 0}">
                                <div class="item">
                                    <img src="${pic}">
                                </div>
                            </c:if>
                        </c:forEach>
                    </div>
                    <a class="left carousel-control" href="#homepage-feature" data-slide="prev">
                        <span class="glyphicon glyphicon-chevron-left"></span>
                    </a>
                    <a class="right carousel-control" href="#homepage-feature" data-slide="next">
                        <span class="glyphicon glyphicon-chevron-right"></span>
                    </a>
                </div>
            </div>
        </div>
    </c:if>

    <c:if test="${not empty corporateIcardPics}">
        <div class="row panel panel-primary clearfix">
            <div class="panel-heading">
                <h3 class="panel-title">法人身份证照片</h3>
            </div>
            <div class="col-md-12 column">
                <div id="homepage-icard" class="carousel">
                    <ol class="carousel-indicators">
                        <c:forEach var="pic" items="${corporateIcardPics}" varStatus="status">
                            <c:if test="${status.index == 0}">
                                <li data-target="#homepage-icard" data-slide-to="${status.index}" class="active"></li>
                            </c:if>
                            <c:if test="${status.index != 0}">
                                <li data-target="#homepage-icard" data-slide-to="${status.index}"></li>
                            </c:if>
                        </c:forEach>
                    </ol>
                    <div class="carousel-inner">
                        <c:forEach var="pic" items="${corporateIcardPics}"  varStatus="status">
                            <c:if test="${status.index == 0}">
                                <div class="item active">
                                    <img src="${pic}">
                                </div>
                            </c:if>
                            <c:if test="${status.index != 0}">
                                <div class="item">
                                    <img src="${pic}">
                                </div>
                            </c:if>
                        </c:forEach>
                    </div>
                    <a class="left carousel-control" href="#homepage-icard" data-slide="prev">
                        <span class="glyphicon glyphicon-chevron-left"></span>
                    </a>
                    <a class="right carousel-control" href="#homepage-icard" data-slide="next">
                        <span class="glyphicon glyphicon-chevron-right"></span>
                    </a>
                </div>
            </div>
        </div>
    </c:if>

    <c:if test="${not empty sellerPics}">
        <div class="row panel panel-primary clearfix">
            <div class="panel-heading">
                <h3 class="panel-title">门店照片</h3>
            </div>
            <div class="col-md-12 column">
                <div id="homepage-seller" class="carousel">
                    <ol class="carousel-indicators">
                        <c:forEach var="pic" items="${sellerPics}" varStatus="status">
                            <c:if test="${status.index == 0}">
                                <li data-target="#homepage-seller" data-slide-to="${status.index}" class="active"></li>
                            </c:if>
                            <c:if test="${status.index != 0}">
                                <li data-target="#homepage-seller" data-slide-to="${status.index}"></li>
                            </c:if>
                        </c:forEach>
                    </ol>
                    <div class="carousel-inner">
                        <c:forEach var="pic" items="${sellerPics}"  varStatus="status">
                            <c:if test="${status.index == 0}">
                                <div class="item active">
                                    <img src="${pic}">
                                </div>
                            </c:if>
                            <c:if test="${status.index != 0}">
                                <div class="item">
                                    <img src="${pic}">
                                </div>
                            </c:if>
                        </c:forEach>
                    </div>
                    <a class="left carousel-control" href="#homepage-seller" data-slide="prev">
                        <span class="glyphicon glyphicon-chevron-left"></span>
                    </a>
                    <a class="right carousel-control" href="#homepage-seller" data-slide="next">
                        <span class="glyphicon glyphicon-chevron-right"></span>
                    </a>
                </div>
            </div>
        </div>
    </c:if>
</div>

<script src="${ctx}/bootstrap/js/vendor/jquery-1.10.2.min.js"></script>
<script>window.jQuery || document.write('<script src="${ctx}/bootstrap/js/vendor/jquery-1.10.2.min.js"><\/script>')</script>
<script src="${ctx}/bootstrap/js/plugins.js"></script>
<script src="${ctx}/bootstrap/js/main.js"></script>

<script type="text/javascript">
    function updateForm() {
        var name = $('#name').val();
        var corporation = $('#corporation').val();
        var bankAccount = $('#bankAccount').val();
        var sellerId = $('#sellerId').val();

        $.ajax({
            type: "post",
            async: false,
            url: "${ctx}/business/seller/updateInfo/" + sellerId,
            data: {name: name, corporation: corporation, bankAccount: bankAccount},
            success: function (json) {
                alert(json);
            },
            error: function () {
            }
        });
    }
</script>
</body>
</html>
